<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<%@ include file="header.jsp"%>
<script src="${path}/static/echarts.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
	<!-- 为 ECharts 准备一个定义了宽高的 DOM -->
    <div id="main" style="width: 600px;height:400px;"></div>
    <script type="text/javascript">
      // 基于准备好的dom，初始化echarts实例
      var myChart = echarts.init(document.getElementById('main'));
      
      $.ajax({
    	  url: '${path}/user?method=selectDeptCount',
    	  type: 'POST',
    	  dataType: 'json',
    	  success: function(jsonObj) {
    		  console.log(jsonObj)
    		  option = {
        		  title: {
        		    text: '部门人数统计',
        		    subtext: 'Fake Data',
        		    left: 'center'
        		  },
        		  tooltip: {
        		    trigger: 'item'
        		  },
        		  legend: {
        		    orient: 'vertical',
        		    left: 'left'
        		  },
        		  series: [
        		    {
        		      name: 'Access From',
        		      type: 'pie',
        		      radius: '50%',
        		      data: jsonObj,
        		      emphasis: {
        		        itemStyle: {
        		          shadowBlur: 10,
        		          shadowOffsetX: 0,
        		          shadowColor: 'rgba(0, 0, 0, 0.5)'
        		        }
        		      }
        		    }
        		  ]
        		};

          // 使用刚指定的配置项和数据显示图表。
          myChart.setOption(option);
    	  }
      });

      
    </script>
</body>
</html>